<?php

class DataBase {

    private static $_con;

    public static function createConection() {
        $_con = @mysql_connect("localhost", "root", "");
        mysql_set_charset('utf8');
        mysql_query("SET NAMES 'utf8'"); /* PARA TRABALHAR COM ACENTOS SEM PROBLEMAS */
        mysql_query("SET character_set_connection=utf8");
        mysql_query("SET character_set_client =utf8");
        mysql_query("SET character_set_results = utf8");
        if ($_con === FALSE) {
            echo "GBD conection failure";
            mysql_error();
            exit;
        } else {
            mysql_select_db("bfat", $_con);
            if ($_con === FALSE) {
                echo "Database selection failure";
                mysql_error();
                exit();
            }
        }
    }

    public static function isGoodConection() {
        if (DataBase::$_con === TRUE)
            return TRUE;
        return FALSE;
    }

}

?>
